<%@ Control Language="C#" AutoEventWireup="true" CodeFile="DentistSearchControl.ascx.cs"
    Inherits="DentistSearchControl" %>
<%--  <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>--%>

<script src="<%=Session["strHttp"]%>/Jscript/Validation.js"></script>
<script>

    //<![CDATA[

    <%if (IsPostBack)
      {%>
    //commented at 18/06/08

    //alert("DentistSearchControl.ascx");
    //showWorking();                   

    //End at 18/06/08


    //workingWin.close(); 
      <%} %>
    function Dentist_selectDistance(obj) {
        //            if(obj.value!=0)
        //            {
        //                if(trim(document.getElementById('<%=txtCity.ClientID%>').value)=="" && trim(document.getElementById('<%=txtZipCode.ClientID%>').value)=="")
          //                    {                   
          //                        obj.value=0;
          //                            alert("Please enter a city name or zip code to utilize Travel Distance feature");
          //                            return false;
          //                    }
          //                if(trim(document.getElementById('<%=txtCity.ClientID%>').value)!="" && trim(document.getElementById('<%=txtZipCode.ClientID%>').value)=="" && trim(document.getElementById('<%=ddlState.ClientID%>').value) =="0")
          //                    {
          //                         alert("Please select a state to utilize Travel Distance feature with city");
          //                            return false;
          //                    }
          //                
          //            }

          var retVal;
          retVal = false;
          //           
          //         
          if (obj.value != 0) {
              //    alert("IN IF");
              if ((trim(document.getElementById('<%=txtCity.ClientID%>').value) != "") && (trim(document.getElementById('<%=txtCity.ClientID%>').value) != "City :")) {
                    retVal = true;
                    //        alert("Set true");
                }
                else {
                    retVal = false;
                    //        alert("Set false");
                }



                if (retVal == false) {
                    if ((trim(document.getElementById('<%=txtZipCode.ClientID%>').value) != "") && (trim(document.getElementById('<%=txtZipCode.ClientID%>').value) != "Zipcode:")) {
                        retVal = true;
                        //            alert("Set ZIP true");
                    }
                    else {
                        retVal = false;
                        //            alert("Set ZIP false");
                    }
                }

                if (retVal) {
                    if (trim(document.getElementById('<%=ddlState.ClientID%>').value) == "0") {
                        alert("Please select a state to utilize Travel Distance feature with city");
                        return false;
                    }
                }
                else {
                    alert("Please enter a city name or zip code to utilize Travel Distance feature");
                    return false;
                }
            }

            return true;
        }
        function Dentist_checkError() {
            v = Dentist_selectDistance(document.getElementById('<%=ddlDistance.ClientID%>'))
    if (v) {
        arr = new Array(document.getElementById('<%=ddlState.ClientID%>'),
         document.getElementById('<%=txtCity.ClientID%>'),
        document.getElementById('<%=txtZipCode.ClientID%>'),
        document.getElementById('<%=ddlRating.ClientID%>'),
        document.getElementById('<%=ddlSpeciality.ClientID%>'),
        document.getElementById('<%=ddlSubSpeciality.ClientID%>'),
        document.getElementById('<%=txtLName.ClientID%>'),
        document.getElementById('<%=ddlDistance.ClientID%>'))
       count = 0;
       for (i = 0 ; i < arr.length ; i++) {
           if ((trim(eval(arr[i]).value) != "0") && (trim(eval(arr[i]).value) != "") && (trim(eval(arr[i]).value) != "City :") && (trim(eval(arr[i]).value) != "Zipcode:") && (trim(eval(arr[i]).value) != "Last Name:")) {
               count++;
           }
       }
       if (count < 2) {
           //THIS TEXT WAS REPLACED WITH THE BELOW ONE : K, 16 DECEMBER 2006
           //alert("Please select atleast 2 conditions for search");
           alert("Please select at least 2 search criteria");
           return false;
       }
       if (chkMinLen(document.getElementById('<%=txtCity.ClientID%>'), 3))
               if (chkMinLen(document.getElementById('<%=txtZipCode.ClientID%>'), 5)) {
                   showWorking();
                   return true;
               }
               else
                   return false;
           else
               return false;
           showWorking();
           return true;
       }
       else
           return v;


   }

   //]]> 
</script>
<%-- <asp:UpdatePanel ID="UpdatePanel4" runat="server" UpdateMode="Always">
              <ContentTemplate>--%>
<table width="214" border="0" align="center" cellpadding="2" cellspacing="0">
    <tr>
        <td>
            <asp:Label ID="lblMesg" runat="Server"></asp:Label></td>
    </tr>
    <tr>
        <td>
            <asp:DropDownList ID="ddlCountry" runat="server" CssClass="mainselection"
                Width="221px" OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged"
                AutoPostBack="True">
            </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td>
            <asp:DropDownList ID="ddlState" runat="server" CssClass="mainselection" Width="221px">
            </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td>
            <asp:TextBox ID="txtCity" runat="Server" CssClass="form-txt" Style="width: 105px"
                Text="City :"></asp:TextBox><asp:TextBox ID="txtZipCode"
                    runat="Server" CssClass="form-txt" Style="width: 105px" Text="Zipcode:"></asp:TextBox></td>
    </tr>
    <tr>
        <td>
            <asp:DropDownList ID="ddlDistance" runat="server" CssClass="mainselection" Width="221">
                <asp:ListItem Value="0">Distance :</asp:ListItem>
                <asp:ListItem Value="5">5 miles or less</asp:ListItem>
                <asp:ListItem Value="10">10 miles or less</asp:ListItem>
                <asp:ListItem Value="25">25 miles or less</asp:ListItem>
                <asp:ListItem Value="50">50 miles or less</asp:ListItem>
                <asp:ListItem Value="100">100 miles or less</asp:ListItem>
            </asp:DropDownList></td>
    </tr>
    <tr>
        <td>
            <asp:TextBox ID="txtLName" runat="Server" CssClass="form-txt" Style="width: 215px"
                Text="Last Name:"></asp:TextBox></td>
    </tr>
    <tr>
        <td>
            <asp:DropDownList ID="ddlSpeciality" runat="server" CssClass="mainselection" Width="221px">
            </asp:DropDownList></td>
    </tr>
    <tr>
        <td>
            <asp:DropDownList ID="ddlSubSpeciality" runat="server" CssClass="mainselection" Width="221px">
            </asp:DropDownList></td>
    </tr>
    <tr>
        <td>
            <asp:DropDownList ID="ddlRating" runat="server" CssClass="mainselection" Width="221">
            </asp:DropDownList></td>
    </tr>
    <tr>
        <td colspan="3" style="float: right">
            <br />
            <asp:Button runat="server" Text="Search" CssClass="buttonclass" ID="btnSearch"
                AlternateText="Search" OnClick="btnSearch_Click" CausesValidation="False" /><br />
            <a href="<%=Session["strHttp"]%>SearchDentist_adv.aspx" class="bluelink">Advance Search</a>
        </td>
    </tr>
</table>
<%--</ContentTemplate>
                </asp:UpdatePanel>--%>
